


async function add() {
    let info = await ajaxPost("/user/add",{
        name: $("name").value,
        sex: $("sex").value,
        money: $("money").value,
        birthday: $("birthday").value
    });

    if (info != "ok") {

        let errorInfo = document.getElementsByClassName("errorInfo");
        for (let i = 0; i < errorInfo.length; i++) {
            errorInfo[i].innerHTML = "";
        }

        for (let i = 0; i < info.length; i++) {
            let infoError = info[i];
            $(infoError.field + "Span").innerHTML = infoError.defaultMessage
        }


    } else {
        location.href = "/html/index.html"
    }
}